package test.pcs;

import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.common.enums.InstProductCategory;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.fund.JMFundService;
import com.payment.lc.pcs.service.api.nocache.PcsQueryService;
import com.payment.lc.pcs.service.bo.ProductionSellInfo;
import com.payment.lc.pcs.service.domain.InfoCascade;
import com.payment.lc.pcs.service.request.GetFundListReq;
import com.payment.lc.pcs.service.request.GetProductsReq;
import com.payment.lc.pcs.service.request.ProductQueryReq;
import com.payment.lc.pcs.service.response.GetFundListResp;
import com.payment.lc.pcs.service.response.PcsCommonPageResp;
import com.payment.lc.pcs.service.response.ProductQueryResp;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import test.BaseTest;

import java.util.List;

/**
 * Created on 2016/8/8.
 */
public class Demo3PcsRevisionTest5 extends BaseTest {

    @Autowired
    PcsQueryService pcsQueryService;

    @Autowired
    ProductionWrapService productionWrapService;

    @Autowired
    @Qualifier("dynamicDataServiceLocal")
    DynamicDataService dynamicDataServiceLocal;
    @Autowired
    @Qualifier("dynamicDataService")
    DynamicDataService dynamicDataService;

    @Autowired
    JMFundService jmFundService;

    @Test
    public void test() throws Exception {
        test2();
    }

    void test6() {
        GetFundListReq req = new GetFundListReq();
        req.setNameOrCode("834");

        GetFundListResp list = jmFundService.getSearchList(req);
        display(list);

        test1();
    }
    void test2() {
        PcsCommonPageResp<InfoCascade> resp = pcsQueryService.getCategoryProviderInfoCascade();
        display(resp);
    }
    void test1() {
        GetProductsReq req = new GetProductsReq();
        req.setInstCategory(InstProductCategory.YueGuJiao );
        PcsCommonPageResp resp = pcsQueryService.getProductsByCategories(req);

        display(resp);
        long s = System.currentTimeMillis();
        List list = productionWrapService.convertProdCodesToProductions(resp.getData());
        long e = System.currentTimeMillis();
        display(list);
        System.out.println(e-s);

        ProductQueryReq req1 = new ProductQueryReq();
        req1.setNameOrCode("1");
        s = System.currentTimeMillis();
        ProductQueryResp resp1 = dynamicDataService.queryProducts(req1);
        e = System.currentTimeMillis();
        display(resp1);
        System.out.println(e-s);
    }


}